FROM ubuntu:latest

RUN apt-get update && apt-get install -y \
    build-essential \
	language-pack-zh-hans \
    libfreetype6 \
    libxext6 \
	libxi6 \
	libxrender1 \
	libxtst6 \
	wget
	
ADD . /app

WORKDIR /app
	
RUN wget https://download.jetbrains.8686c.com/cpp/CLion-2017.3.4.tar.gz \
    && tar xvf CLion-2017.3.4.tar.gz \
	&& rm -f CLion-2017.3.4.tar.gz

RUN mv clion-2017.3.4 CLion

RUN apt-get autoclean && apt-get autoremove

RUN mkdir -p /usr/share/fonts/truetype

ADD simsun.ttc /usr/share/fonts/truetype/

ADD simhei.ttf /usr/share/fonts/truetype/

ENTRYPOINT ["./CLion/bin/clion.sh"]

#local
#    docker run --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY clion
#remote
#    docker run -e DISPLAY=10.0.75.1:0.0 --rm clion